﻿namespace TShooter.TfsWord.Win.UI
{
    public static class ApiHelper
    {
        //private const string UIHOST_TYPE_NAME = "Microsoft.TeamFoundation.OfficeIntegration.Client.OfficeUIHost";
        //private const string INITIALIZE_METHOD_NAME = "Initialize";
        //private const string SHUTDOWN_METHOD_NAME = "Shutdown";
        //private const string ICON_RESOURCE_NAME = "Resources.TfsWord.icos";

        //public static void InitializeUIHost(IWin32Window parentWindow, string appName)
        //{
        //    var assembly = Assembly.GetAssembly(typeof(DocumentLaunch));
        //    var windowsHost = assembly.GetType(UIHOST_TYPE_NAME);
        //    var method = windowsHost.GetMethod(INITIALIZE_METHOD_NAME, new[] {typeof (IWin32Window), typeof (string)});

        //    method.Invoke(windowsHost, new object[] {parentWindow, appName});

        //    //var method = windowsHost.GetMethod(INITIALIZE_METHOD_NAME, new[] {typeof(Icon)});

        //    //using (var iconResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof (ApiHelper), ICON_RESOURCE_NAME))
        //    //{
        //    //    if (iconResourceStream != null)
        //    //    {
        //    //        method.Invoke(windowsHost, new [] { new Icon(iconResourceStream) });
        //    //    }
        //    //    else
        //    //    {
        //    //        method.Invoke(windowsHost, new object[] { null });
        //    //    }
        //    //}
        //}

        //public static void ShutdownUIHost()
        //{
        //    var assembly = Assembly.GetAssembly(typeof(DocumentLaunch));
        //    var windowsHost = assembly.GetType(UIHOST_TYPE_NAME);
        //    var method = windowsHost.GetMethod(SHUTDOWN_METHOD_NAME, BindingFlags.Public|BindingFlags.Instance);

        //    //method.Invoke(windowsHost, null);

        //    Application.DoEvents();
        //    Thread.Sleep(100);
        //}
    }
}
 